package sctu.edu.java.year2016.team07.liaohengju.day20160606.chapter9_1;

/**
 * Created by hengju on 2016/6/6.
 * 编写一个程序，创建一个类，并在类中创建一个成员内部类，
 * 通过成员内部类计算1到任意数的和的操作，并在外部类进行测试。
 */
public class OuterClass {
    InnerClass in = new InnerClass();

    public void Get() {
        in.Sum();
    }

    private class InnerClass {
        public void Sum() {
            int sum = 0;
            for (int a = 0; a <= 10; a++) {
                sum = sum + a;
            }
            System.out.println("1加到10的值:" + sum);
        }
    }

    public static void main(String[] args) {
        OuterClass out = new OuterClass();
        out.Get();
    }
}



